\documentclass{article}
% translate with >> pdflatex -shell-escape <file>

% This file is used as unit test for pgfplots, copyright by Christian Feuersaenger.
% 
% See
%   http://pgfplots.sourceforge.net/pgfplots.pdf
% for pgfplots.
%
% Any required input files (for <plot table> or <plot file> or the table package) can be downloaded
% at
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/
% and
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/plotdata/

\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

\pagestyle{empty}

\begin{document}

\def\example#1{%
\begin{tikzpicture}[#1]
	\begin{axis}[stack plots=y,
		legend style={at={(0.03,0.97)},anchor=north west}
	]
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)}  \closedcycle;
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)} \closedcycle;
	\addplot+[fill] coordinates {(0,0.5) (1,1) (2,1) (3,2) (4,2)} \closedcycle;
	\legend{1,2,3}%
	\end{axis}
\end{tikzpicture}
}

\example{const plot mark left}

\example{const plot mark right}
\end{document}
